define(function (require) {

var zsApp = require('app');
zsApp.controller( 'indexController',["$rootScope","$scope","$http","$state","$stateParams","$rootScope","$filter", function($rootScope, $scope,$http,$state,$stateParams,$rootScope,$filter){
	// 中少端口
	//$rootScope.zsUrl = 'http://192.168.0.154:8080/';
	$rootScope.zsUrl = 'http://192.168.0.155:8080/';
	// 每条数据对应的ID
	$scope.dataID = [];
	// 每条数据对应的名字
	$scope.dataName = [];
	// 每条数据对应的编码
	$scope.dataCode = [];
	// 表格每行序列号
	$scope.index = 0;
	// 储存ID
	$scope.roleGroupId = [];
	// 防止恶意点击
	$scope.isRequestCurrentPage = 0;
	$scope.isRequestItemsPerPage = 0;
	$scope.nowTime = 0;
	// 暂无数据
	$scope.isNoData = true;
	$scope.isNoDataSub = true;

	// 检索下拉框
	$scope.userCaret = false;
	$scope.caret = function(){
		$scope.userCaret = !$scope.userCaret;
	}
	
	// 操作提示
	$rootScope.prompt = false;
	$rootScope.promptStatement = "";
	
	// 左侧导航栏缩进功能
	
	$scope.$watch("$scope.isActive", function(){
		$scope.isActive = true;
		$scope.indent = function() {
		 	$scope.isActive = !$scope.isActive;	
		 	console.log($scope.isActive)
		}
    	
	})
	console.log($scope.isActive)
	 
	$rootScope.topanimation =true; 
	
	$scope.system = function(){
		$state.go("system.config");
	}
	$rootScope.$state = $state;
	console.log($state.current.name)
	
	

	$scope.trOpen = function(){
		$scope.tropenimg = !$scope.tropenimg;
		$scope.tropen = !$scope.tropen;
	}
			
	$scope.mune = false;		
	$scope.munec = function(){
		$scope.mune = !$scope.mune;
	}

//$scope.list2 = [
//	{ 'title': 'Item 1', 'drag': true },
//	{ 'title': 'Item 2', 'drag': true },
//	{ 'title': 'Item 3', 'drag': true },
//  { 'title': 'Item 4', 'drag': true },
//  { 'title': 'Item 5', 'drag': true },
//  { 'title': 'Item 6', 'drag': true },
//  { 'title': 'Item 7', 'drag': true },
//  { 'title': 'Item 8', 'drag': true }
//];
//console.log($scope.list2)
//$scope.list3 = [
//	{ 'title': 'Item 9',  'drag': true },
//	{ 'title': 'Item 10', 'drag': true },
//	{ 'title': 'Item 11', 'drag': true },
//  { 'title': 'Item 12', 'drag': true },
//  { 'title': 'Item 13', 'drag': true },
//  { 'title': 'Item 14', 'drag': true },
//  { 'title': 'Item 15', 'drag': true },
//  { 'title': 'Item 16', 'drag': true }
//];
  

  // Limit items to be dropped in list1
//$scope.optionsList1 = {
//  accept: function(dragEl) {
//    if ($scope.list1.length >= 2) {
//      return false;
//    } else {
//      return true;
//    }
//  }
//}; 
}])
.directive('checkboxcustom',function(){
        return {
            restrict: 'AEC',
            replace: true,
            transclude: true,
            template: '<div class="checkbox_custom_inside" ng-class="{checked: isChecked}" ng-click="toggleMe($index)"></div>',
            scope: {isChecked: '=?', ngDisabled: '=?'},
            link: function (scope, elem, attrs) {
                scope.toggleMe = function () {
                    if(!scope.ngDisabled)
                        scope.isChecked = !(scope.isChecked);
                }
            }
        }
})
});

